<template>
  <div>
    <div class="head">
      <a @click="prev" id="btn_back_chanping" class="return"></a>实名认证
    </div>
    <form id="applyRealNameForm">
      <div class="weui-cells weui-cells_form">
        <div class="weui-cell weui_lineheight">
          <div class="weui-cell__hd">
            <label class="weui-label">银行卡号</label>
          </div>
          <div class="weui-cell__bd">
            <input name="bankNo" id="bankNo" value="" class="weui-input" type="text" placeholder="请输入银行卡号">
          </div>
        </div>
        <div class="weui-cell weui_lineheight">
          <div class="weui-cell__hd">
            <label class="weui-label">预留手机号码</label>
          </div>
          <div class="weui-cell__bd">
            <input name="bankMobile" id="bankMobile" value="" class="weui-input" type="text" placeholder="请输入银行预留手机号码">
          </div>
        </div>
        <div class="weui-cell weui_lineheight" id="smsCode_Div">
          <div class="weui-cell__hd">
            <label class="weui-label">验证码</label>
          </div>
          <div class="weui-cell__bd">
            <input name="smsCode" id="smsCode" value="" class="weui-input" type="text" placeholder="请输入验证码">
          </div>
          <div class="weui-cell__ft" @click="sms">
            <Obtain :off = 'off'></Obtain>
          </div>
        </div>
        <div class="weui-msg__opr-area" id="smsCode_Button">
          <p class="weui-btn-area">
            <a class="weui-btn weui-btn_primary" @click="verifyBtn">认证提交</a>
          </p>
        </div>
      </div>
    </form>
    <div class="weui-fixed-btm p10 weui-tab__bd-item" id="applyBtnDiv">
      <a @click="applyRealNameBtn" class="weui-btn weui-btn_primary weui-btn_shenqing">提交申请</a>
    </div>
  </div>
</template>

<script>
import Obtain from '@/components/verification_code/obtain'
import $ from 'jquery'
window.jQuery = $
window.$ = $
export default {
  data () {
    return {
      off: false,
      off2: false
    }
  },
  components: {
    Obtain
  },
  methods: {
    prev: function () {
      this.$router.go(-1)
    },
    sms: function () {
      var bankNo = $('#bankNo').val()
      if (bankNo === '') {
        $.toast('请输入银行卡号', 'text')
        $('#bankNo').focus()
        return
      }
//    if (!this.util.ID(bankNo)) {
//      $.toast('请输入正确的银行卡号', 'text')
//      $('#bankNo').focus()
//      return
//    }
      var bankMobile = $('#bankMobile').val()
      if (bankMobile === '') {
        $.toast('请输入预留手机号码', 'text')
        $('#bankMobile').focus()
        return
      }
      if (!this.util.phoneNumber(bankMobile)) {
        $.toast('请输入正确的预留手机号码', 'text')
        $('#bankMobile').focus()
        return
      }
      this.off = true
    },
    verifyBtn: function () {
      var smsCode = $('#smsCode').val()
	  if (smsCode === '') {
	    $.toast('请输入验证码', 'text')
	    $('#smsCode').focus()
	    return
	  }
	  this.off2 = true
    },
    applyRealNameBtn: function () {
      console.log(this.off2)
      if (!this.off2) {
      	$.toast('请先完成实名认证', 'text')
      }
    }
  }
}
</script>

<style lang="css" scoped>
@import '../../../assets/styles/loanrealname.css'
</style>
